/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 */

package com.device.idea.demo.core;

import android.content.Context;
import android.view.View;
import android.widget.CheckedTextView;

import com.device.idea.demo.R;

import java.util.List;

/**
 * RecognitionLangAdapter
 *
 * @since 2021-01-01
 */
public class RecognitionLangAdapter extends CommonAdapter<RecognitionLang> {
    /**
     * CommonAdapter
     *
     * @param context context
     * @param list List
     * @param layoutId layoutId
     */
    public RecognitionLangAdapter(Context context, List<RecognitionLang> list, int layoutId) {
        super(context, list, layoutId);
    }

    @Override
    public void convert(CommonViewHolder holder, RecognitionLang item, int position) {
        View view = holder.getView(R.id.ctv_recognition_lang);
        if (view instanceof CheckedTextView) {
            ((CheckedTextView) view).setChecked(item.isChecked());
            ((CheckedTextView) view).setText(item.getLangName());
        }
    }
}
